package com.etc.util;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102500759556";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCG127eNxb+UEzpnjNFsSqOnB5FJJHD0js/CePD7GYDadUfa3e/nH6Fo4JSME1gaQiQ33Kc7SPn7WWnECFbGQIB8qzd3f46gr5jbF7kNNHVvimEwQAjbEL0kvBTgJ7yhCZjsKVRIlEnpNt40pT3Ek9nv92cfy+YwhgHPinVzAHBZYuwhi+Mte848a9uYCMbEcYOC9rq7uqLWz4gaD46EpogMLOFj4Js2JAQnqcRbrQ8BbnUoKd5UtRiMpZyfg+sMGjYbL3YG4Ma9FGEsqcWPt72BjAT9Pn8HsRA28b0tNn2fQz1Wrm0yOwVEUjndHWdPyT5glIrDHTFIAXvWyRnyt8VAgMBAAECggEAXkavuGQyClsge1JlrLti8tSKgXNBCvWpALksayaUaJyNKuubjPegqlUY39fvsZGeMJRZ8QgIS7b6lKS9fZDti2kdnf4BKu2QqbjyW4HmmBfdtXivXRTrd05pAyjxeMQWhyrRWvmwXhRwcnhhOKGvrO1Dx5BROe+ylxXKcDWzoIAX56Cq+eY2hXliwA2UHlb1TfKErFb41Hl9tjvZNv3JCM2hABTh7X0/dS6HpPZeWdwbX0iZgzE0j0bkDsDlK5CLqRDPzuxeK6hrZMdykU2F4AdlO/ReJwpcso1F5KyJEJZ2O1SMEYWUFhbkHXGvpT1znlXiDJZq2PjX4p4FGsQvwQKBgQDChpPlvoI+NDOH5MEfgnxI2I3HcAOmO1XePgH/xeDPMjgGIVJV9JoJNboEde5i0X7q70tyonbV5mingdW+p0K0kUzwnzOzhq4Tt7P7/H0mQqYlhx9z7/UWukG5BLMXX/LthtwKV4SGfTx2oEDT2YSKtEr9sapWmzWwJjKmYdG7JQKBgQCxdFEbVeh3YS9jwFliAUFS1RiaMCaWlWjCiOpg67SCtwDRkCoOGj4hYd/DqxVMUF8Zsoq95OU2xPskM9i0nvfX4U4LrL6YaGhqoo6hk4S0kDFMm74HpVlGS8m8lJ5dLx877o4E3HTMgbfhO4gZwY4XlNmOa2E3RPPPtoVGxP7JMQKBgQC4kskybRlXvGBIyR0VsNIMrK2aVwafbB2FyoBLGI6/Cn9uEZ/2PykJJBlksiGHUhCDCpskIlNvkjgq+F6/kCUS/+tpRSXhaiEyRFRa/LAi5YqQgS2u7Dg5YHGMBJGJ1FjEV/nhNjlhAuOkC1p3qSTCF2AwZ6ugkZTXluboSFigoQKBgEU1cEyQ/NFSfgERi8rFYozDv4yjKumf6/OzInYad5Rje1ZAO6a0ZXbvjS3rE6tnzS9giuv00dDCkpBUCDipp0/y91VmUg9u6Qpty+MIfcFOW2vdcgfZXTAlbtC1xe3h6vSc3ZbXxFXeYbDeXv5sltZrn04EYy4DHnPsY55uRlCBAoGANpKTAOrYk8vl0h41WWVLRFGQg4K/l8F1tROiQiM1B9wbfbFCf9FX9NEwiWTJloEJDDSlMa5cEswsAzSLzJulAWIHxnc98EZxOAoZ3sOKy2eOAtJcK2dWCVeM5fodx9ICpVb6cXylc9M26dkzRv5JRhaSxoE1ppJyRcv0aN6bWkI=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo2dRYorwXsUFUe3WLaTrynszGRHu1hbF79oPGu6pBUNYCoTMDFk6GCj7sl8gHweUW/VVPTVasQ8CRaXeomqyhpvUDpyoBBDUCcwrqUgK7jUmO4gy8iMNMwWcKNcHlbuLBTvhrO3atOcVLbezeDrRSV1+ZfxYRfKKK8rgVbkrtHprMM1SioEek1y63z8QZm5/yJfznYi6OHnK1K/+3DSyu/TrOwswnRhJXl1IVxRWU2DuB/nJUFwPBFDavTdA1A7FFp6elWkKqsDc+tgR1bMn1BDHwlKUoMosU6PPyaKsSOOv8gE/7SiQVlzfA+NxPVZGl34++3kRpdMebKDc2ndx2wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/shop/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/shop/ShoppingcartController/success";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 日志输出根目录
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

